﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YYSite.Common.Domain;

namespace YYSite.Domain.BaseData.SchoolYears
{
    public class SchoolYear : EntityBase<Guid>
    {
        public virtual int StudyYear { get; set; }
        public virtual int Semester { get; set; }

        public virtual DateTime StudyStartDay { get; set; }

        public virtual DateTime StudyEndDay { get; set; }

        public virtual DateTime RecessStartDay { get; set; }

        public virtual DateTime RecessEndDay { get; set; }

        public override bool Equals(object obj)
        {
            if (obj == null)
                return false;
            var studyYear = obj as SchoolYear;
            if (studyYear == null)
                return false;
            return studyYear.StudyYear == this.StudyYear && studyYear.Semester == this.Semester;
        }

        public override int GetHashCode()
        {
            string key = string.Format("{0}-{1}", this.StudyYear, this.Semester);

            return key.GetHashCode();
        }
    }
}
